<script src="__PUBLIC__/js/jquery.datePicker-min.js" type="text/javascript"></script>
<link href="__PUBLIC__/js/datePicker.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
	$("#typeid").change(function(){
		var id=this.value;
		ch_type(id);
	});
	$('.showend_job').datePicker({clickInput:true});
	var typeid=$("#typeid").val();
	if(typeid!=0){
		ch_type(typeid);
	}
	<if condition="$data['channel']">
		ch_type("{$data['channel']}_{$data['typeid']}");
	</if>
	$(".show_contact").click(function(){
		if(this.id=='hide_contact'){
			$(".show_contact").attr("id",'show_contact');
			$(".show_contact").val('Show contact information');
			$("#show_contact2").hide();
		}else{
			$(".show_contact").attr("id",'hide_contact');
			$(".show_contact").val('Hide contact information');
			$("#show_contact2").show();
		}
	});
});
function ch_type(id){
	id=id.split('_');
	var cache=$("#cache").html();
	id="#channel_"+id['0'];
	if(id!=cache){
		$("#channel").html($(id).html());
		$("#cache").html(id);
	}
}
function zone(obj,id,name){
	if(name==0){
		var cid=obj.options[obj.options.selectedIndex].value;
	}else{
		var cid=obj.options[obj.options.selectedIndex].className;
	}
	if(cid=='Other'){
		$(id).hide();
	}else{
		$(id).show();
		$(id).load(URL+'/ajax_zone',{cid:cid,types:'localion',name:name});
	}
}
</script>
<div class="mulu">
	<a href="__APP__/">Home</a> > <a href="__APP__/Cp/index">Control Panel</a> > 
	<a href="__APP__/Cp/my_classifieds_post">My Post Classifieds</a>
</div>
<div class="right-neirong">
    <div class="clear">
    </div>
    <div class="right-messages">
        <div class="right-title">
            <h3 style="margin:0;">Post Classifieds</h3>
        </div>
        <div class="list">
            <form action="__URL__/add_classifieds" method="post" enctype="multipart/form-data">
            	<if condition="$data['id']"><input type="hidden" name="id" value="{$data['id']}"></if>
            	<p>
            	<strong>Step 1: Fill in the information and submit it. </strong><br>
            	<strong>Step 2: </strong>Add picture(s) and finish the post. <br>
            	<strong>Step 3: </strong><a href="__APP__/Cp/my_classifieds_post">Back to the list</a>. 
            	</p>
            	<fieldset>
				<legend>Basic Elements:</legend>
	            	<p>
	            		<label for="title">Title:</label><input type="text" name="title" id="title" value="{$data['title']}" style="width:300px;">
					</p>
					<p><label for="showend_job">Valid for</label>
						<input type="text" name="showstart" id="showend_job" class="showend_job" value="{$data['showstart']|toDate='d/m/Y'}" style="width:80px;">
						---> <input type="text" name="showend" id="showend_job" class="showend_job" value="{$data['showend']|toDate='d/m/Y'}" style="width:80px;">
					</p>
					<p>
						<label for="cid">Post to</label>
						<select name="cid" id="cid">
							<option value="Select City">--Select City--</option>
							
							<volist name="citylist" id="v">
								<option value="{$v['id']}"{$v['id']|selected=$data['cid']}>{$v['ctitle']}</option>
							</volist>
							<option value="0">All</option>
						</select>
					</p>
					<p>
						<label for="keywords">Tags:</label>
						<input type="text" name="keywords" id="keywords" value="{$data['keywords']}" class="w320"><br>
                        Please separate tags with ",".
					</p>
					<p>
						<label for="typeid">Select Section:</label>
						<select id="typeid" name="typeid">
							<option>---Select Main Category---</option>
							<volist name="class_tree" id="v">
								<if condition="$data['channel']">
									<if condition="$data['channel'] eq $v['channeltype']">
										<if condition="$v['ispart'] eq 1">
											<optgroup label="{$v['typename']}">
												<volist name="v['_son']" id="vs">
													<option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>{$vs['typename']}</option>
												</volist>
											</optgroup>
										<else/>
											<option value="{$v['id']}"{$v['id']|selected=$data['typeid']}>{$v['typename']}</option>
										</if>
									</if>
								<else/>
									<if condition="$v['ispart'] eq 1">
										<optgroup label="{$v['typename']}">
											<volist name="v['_son']" id="vs">
												<option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>{$vs['typename']}</option>
											</volist>
										</optgroup>
									<else/>
										<option value="{$v['id']}"{$v['id']|selected=$data['typeid']}>{$v['typename']}</option>
									</if>
								</if>
							</volist>
						</select>
					</p>
				</fieldset>
				<fieldset>
					<legend>contact information</legend>
					<p>Fill in your contact information, so that others can reach you as soon as possible.</p>
                    <p><input type="button" value="Show contact information" id="show_contact" class="show_contact" /></p>
					<div id="show_contact2" style="display:none;">
					<p><label for="contact">Address:</label>
						<input type="text" name="contact" id="contact" value="{$data['contact']}" style="width:300px;">
					</p>
					<p><label for="telephone">Telephone:</label>
						<input type="text" name="telephone" id="telephone" value="{$data['telephone']}">
					</p>
					<p><label for="fax">Fax:</label>
						<input type="text" name="fax" id="fax" value="{$data['fax']}">
					</p>
					<p><label for="mobphone">Mobile:</label>
						<input type="text" name="mobphone" id="mobphone" value="{$data['mobphone']}">
					</p>
					<p><label for="email">Email:</label>
						<input type="text" name="email" id="email" value="{$data['email']}">
					</p>
					<p><label for="msn">Msn:</label>
						<input type="text" name="msn" id="msn" value="{$data['msn']}">
					</p>
					<p><label for="oicq">QQ:</label>
						<input type="text" name="oicq" id="oicq" value="{$data['oicq']}">
					</p>
					<p><label for="linkman">Contact:</label>
						<input type="text" name="linkman" id="linkman" value="{$data['linkman']}">
					</p>
					</div>
				</fieldset>
				
				<div id="channel"></div>
				{//4jobs 5realestate 6commerce 7agents 8personals 9services  style="display:none;"}
				<span id="cache" style="display:none;"></span>
				<p>
					<input type="submit" value="Submit">            
					<input type="reset" value="Reset">            
				</p>
            </form>
        </div>
    </div>
</div>
<div class="clear"></div>
<div id="scache" style="display:none;">
<div id="channel_4">
	<fieldset class="channel">
				<legend>Jobs:</legend>
					<p>
						<label for="itype">*Type:</label>
						<!--input type="radio" name="itype" id="itype" value="0"<php>echo selected(0,$data['itype'],'checked');</php>>All-->   
						<input type="radio" name="itype" value="1"<php>echo selected(0,$data['itype'],'checked');</php>>Offered   
						<input type="radio" name="itype" value="2"<php>echo selected(0,$data['itype'],'checked');</php>>Wanted   
					</p>
					<p>
						<label for="category">*Category:</label>
						<select name="category" id="category">
							<option>--Select Category--</option>
							<option value="0"<php>echo selected(0,$data['category']);</php>>All</option>
							<option value="1"<php>echo selected(1,$data['category']);</php>>Full time</option>
							<option value="2"<php>echo selected(2,$data['category']);</php>>Part time</option>
							<option value="3"<php>echo selected(3,$data['category']);</php>>Internship</option>
							<option value="4"<php>echo selected(4,$data['category']);</php>>Voluntary</option>
						</select>
					</p>
					<p>
						<label for="position">*Position:</label>
						<input type="text" name="position" id="position" value="{$data['position']}">
						
					</p>
					<p><label for="salary">Salary:</label>
						<input type="text" name="salary" id="salary" value="{$addon['salary']}">RMB
						<span style="color:#999999; float:none;">(Expected salary / Offered salary )</span>
					</p>
					<p><label for="experience">Experience:</label>
						<input type="text" name="experience" id="experience" value="{$addon['experience']}">Months
						<span style="color:#999999; float:none;">(Work experience required / Personal work experience)</span>
					</p>

					<p><label for="joblocated">*Job located:</label>
						<select name="joblocated[0]" class="city_id" onchange="zone(this,'.job_zone_id',1)">
							<option value="0">--Favorite City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['ctitle']}" class="{$v['id']}">{$v['ctitle']}</option>
							</volist>
							<option value="Other" class="Other">--Other--</option>
						</select>
						<select name="joblocated[1]" class="job_zone_id">
							<option value="0">--Select District--</option>
						</select>
						<input type="text" name="joblocated[2]" id="joblocated">
					</p>
					<if condition="$addon['joblocated']">
					<p>
						<label for="joblocated">Job located in:</label>{$addon['joblocated']}<br>
					</p>
					</if>
					<p>
						<label for="editor_editor4">*Description:</label>
						<textarea id="editor_editor4" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>
<div id="channel_5">
				<fieldset class="channel">
				<legend>Property:</legend>
					<p>
						<label for="itype">*Type:</label>
						<input type="radio" name="itype" id="itype" value="0"<php>echo selected(0,$data['itype'],'checked');</php>/>All   
						<input type="radio" name="itype" value="1"<php>echo selected(1,$data['itype'],'checked');</php>/>Offered    
						<input type="radio" name="itype" value="2"<php>echo selected(2,$data['itype'],'checked');</php>/>Wanted
					</p>
					<p>
						<label for="category">*Category:</label>
						<select name="category" id="category">
							<option value="All"<php>echo selected('All',$data['category']);</php>>All</option>
							<option value="Family House/Villa"<php>echo selected('Family House/Villa',$data['category']);</php>>Family House/Villa</option>
							<option value="Apartment/Flat"<php>echo selected('Apartment/Flat',$data['category']);</php>>Apartment/Flat</option>
							<option value="Office/Commercial"<php>echo selected('Office/Commercial',$data['category']);</php>>Office/Commercial</option>
						</select>
					</p>
					<p>
						<label for="position">*Property <br>located:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">-Favorite City-</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
							<option value="Other">-Other-</option>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">-Select District-</option>
							<if condition="$data['city_id']">
								<volist name="citylist[$data['city_id']]['_zone']" id="v">
									<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
								</volist>
							</if>
						</select>
						<br>
						<input type="text" name="position" id="position" value="{$data['position']}">
					</p>
					<p><label for="salary">Price:</label>
						<input type="text" name="salary" id="salary" value="{$addon['salary']}">
					</p>
					<p><label for="published">Published by:</label>
						<input type="radio" name="published" value="agency"<php> echo selected('agency',$addon['published'],'checked');</php>>agency
						<input type="radio" name="published" value="company"<php> echo selected('company',$addon['published'],'checked');</php>>company
						<input type="radio" name="published" value="personnel"<php> echo selected('personnel',$addon['published'],'checked');</php>>Personnel
					</p>
					<p>
						<label for="editor_editor5">Description:</label>
						<textarea id="editor_editor5" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>

<div id="channel_6">
				<fieldset class="channel">
				<legend>Commerce:</legend>
					<p>
						<label for="itype">Condition:</label>
						<input type="radio" id="itype" name="itype" value="0"<php> echo selected('0',$data['itype'],'checked');</php>>All   
						<input type="radio" name="itype" value="1"<php> echo selected('1',$data['itype'],'checked');</php>>Offered 
						<input type="radio" name="itype" value="2"<php> echo selected('2',$data['itype'],'checked');</php>>Wanted 
					</p>
					<p>
						<label for="category">Category:</label>
							<input type="radio" id="category" name="category" value="0"<php> echo selected('0',$data['category'],'checked');</php>>Brand-new   
							<input type="radio" name="category" value="1"<php> echo selected('1',$data['category'],'checked');</php>>Second-hand  
					</p>
					<p>
						<label for="position">My Location:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">--Favorite City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">--Select District--</option>
							<if condition="$data['city_id']">
								<volist name="citylist[$data['city_id']]['_zone']" id="v">
									<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
								</volist>
							</if>
						</select>
						<input type="text" name="position" id="position" value="{$data['position']}">
					</p>
					<p>
						<label for="quantity">Quantity:</label>
						<input type="text" name="quantity" id="quantity" value="{$addon['quantity']}">
					</p>

					<p><label for="salary">Price:</label>
						<input type="text" name="salary" id="salary" value="{$addon['salary']}">
					</p>
					<p>
						<label for="editor_editor6">Description:</label>
						<textarea id="editor_editor6" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>
<div id="channel_7">
				<fieldset class="channel">
				<legend>Agents:</legend>
					<p>
						<label for="position">My Location:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">--Favorite City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">--Select District--</option>
							<if condition="$data['city_id']">
								<volist name="citylist[$data['city_id']]['_zone']" id="v">
									<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
								</volist>
							</if>
						</select>
						<input type="text" name="position" id="position" value="{$data['position']}">
					</p>
					<p>
						<label for="editor_editor7">Description:</label>
						<textarea id="editor_editor7" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>
<div id="channel_8">
				<fieldset class="channel">
				<legend>Properties:</legend>
					<p>
						<label for="position">My Location:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">--Favorite City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">--Select District--</option>
							<if condition="$data['city_id']">
								<volist name="citylist[$data['city_id']]['_zone']" id="v">
									<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
								</volist>
							</if>
						</select>
						<input type="text" name="position" id="position" value="{$data['position']}">
					</p>
					<p>
						<label for="editor_editor8">Description:</label>
						<textarea id="editor_editor8" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>
<div id="channel_9">
				<fieldset class="channel">
				<legend>Services:</legend>
					<p>
						<label for="itype">Type:</label>
						<input type="radio" name="itype" id="itype" value="1"<php> echo selected('1',$data['itype'],'checked');</php>/>All   
						<input type="radio" name="itype" id="itype" value="2"<php> echo selected('2',$data['itype'],'checked');</php>/>Offered
						<input type="radio" name="itype" id="itype" value="3"<php> echo selected('3',$data['itype'],'checked');</php>/>Wanted
					</p>
					<p>
						<label for="category">Category:</label>
						<select name="category" id="category">
							<option value="0"<php> echo selected('0',$data['category'],'checked');</php>>All</option>
							<option value="1"<php> echo selected('1',$data['category'],'checked');</php>>Full time</option>
							<option value="2"<php> echo selected('2',$data['category'],'checked');</php>>Part time</option>
							<option value="3"<php> echo selected('3',$data['category'],'checked');</php>>Internship</option>
							<option value="4"<php> echo selected('4',$data['category'],'checked');</php>>Voluntary</option>
						</select>
					</p>
					<p>
						<label for="position">Service<br>located:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">--Select City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">--Select District--</option>
							<if condition="$data['city_id']">
								<volist name="citylist[$data['city_id']]['_zone']" id="v">
									<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
								</volist>
							</if>
						</select>
						<br>
						<input type="text" name="position" id="position" value="{$data['position']}">
					</p>
					<p>
						<label for="editor_editor9">Description:</label>
						<textarea id="editor_editor9" name="content" rows="8" cols="50">{$addon['content']|br2nl}</textarea>
					</p>
				</fieldset>
</div>
</div>


